package com.study.api.factory;

import com.study.api.service.ProductService;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class ProductFallbackFactory implements FallbackFactory<ProductService> {
    @Override
    public ProductService create(Throwable throwable) {
        return new ProductService() {
            @Override
            public String hi() {
                return "调用hi接口失败了！" + throwable.getMessage();
            }

            @Override
            public String hello() {
                return "调用hello接口失败了！" + throwable.getMessage();
            }
        };
    }
}
